﻿using System.Net;
using System.Xml.Serialization;

namespace Toybox.NicoSharp.Ads
{
	using Extensions;
	using Utilities;

	[XmlRoot(@"getad")]
	public class LivePlayerAd
	{

		#region [Static]

		public static LivePlayerAd Get(CookieCollection cookies = null)
		{
			string url = NicoUrls.WatchLiveApi + "getad";
			string xml = NicoWebClient.Get(url, cookies.Coerce());
			return Deserializer.XmlDeserializer<LivePlayerAd>(xml);
		}

		#endregion [Static]


		#region Public Members

		/// <summary>
		/// 取得結果
		/// </summary>
		[XmlAttribute]
		public string status;

		[XmlArrayItem("ad")]
		public Ad[] adinfo;

		#endregion Public Members


		#region [SubClass]

		public class Ad
		{
			public string url;

			public string thumbnail;
		}

		#endregion [SubClass]

	}
}
